#!/usr/bin/perl
#mdmhistory-lib.pl

do "../web-lib.pl";
&init_config();
%access = &get_module_acl();

#mdm_log($operate,\@data)
sub mdm_log()
{
	local @file;
	local $mydata=$_[1];
	local @mydata=@$mydata;
	local $mdmtime=localtime(time());
	chomp($mdmtime);
	local @mdmtime=split(/ /,$mdmtime);
	
	if (!(-f $config{'mdmlogfile'})){
		`mkdir -p $config{'mdmlogdir'}`;
		`touch $config{'mdmlogfile'}`;
	}

	$mdmtime=join(" ",$mdmtime[4],$mdmtime[1],$mdmtime[2],$mdmtime[3]);
	$file[0]="[TIME - $mdmtime]\n";
	$file[1]="[OPERATE - $_[0]]\n";
	
	for ($i=0;$i<@mydata;$i++){
		$file[$i+2]="	$mydata[$i]\n";
	}

	$file[$i+2]="\n";
	open(FILE,">>$config{'mdmlogfile'}")|| die "open failed:$!\n";
	print FILE @file;
	close (FILE);
}




1;